<template>
  <el-table :data="tableData" style="width: 100%,height: 100%" max-height="600px">
    <el-table-column fixed prop="id" label="编号" width="100"> </el-table-column>
    <el-table-column prop="age" label="年龄" width="120"> </el-table-column>
    <el-table-column prop="sex" label="性别" width="120"> </el-table-column>
    <el-table-column prop="cp" label="疾病类型" width="120"> </el-table-column>
    <el-table-column prop="trestbps" label="静息血压" width="120"> </el-table-column>
    <el-table-column prop="chol" label="血清胆汁淤积" width="120"> </el-table-column>
    <el-table-column prop="fbs" label="空腹血糖" width="120"> </el-table-column>
    <el-table-column prop="restecg" label="静息心电图结果" width="120"> </el-table-column>
    <el-table-column prop="thalach" label="最大心率" width="120"> </el-table-column>
    <el-table-column prop="exang" label="运动诱发心绞痛" width="120"> </el-table-column>
    <el-table-column prop="oldpeak" label="ST段压" width="120"> </el-table-column>
    <el-table-column
      prop="slope"
      label="高峰运动ST段的斜率"
      width="120"
    ></el-table-column>
    <el-table-column prop="ca" label="蓬松染色的数量" width="120"> </el-table-column>
    <el-table-column prop="thal" label="缺陷类型" width="120"> </el-table-column>
    <el-table-column prop="target" label="是否患病" width="120"> </el-table-column>
    <el-table-column fixed="right" label="操作" width="100">
      <template #default="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small"
          >查看</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import { post, get, setItem, getItem, remItem, GetDataTest } from "../../utils/com";
import { defineComponent, reactive, ref } from "vue";
export default defineComponent({
  name: "Grop2",
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    handleClick(row) {
      console.log(row.id);
      alert("编号: "+row.id+" , 是否患病："+row.target)
    },
    users_getall() {
      const _this = this;
      var myget = get("http://127.0.0.1:8000/user/getall").then(function (res) {
        _this.tableData = res;
        return res;
      });
    },
  },
  mounted() {
    this.users_getall();
  },
});
</script>
